/**
 * Created by etaishuo153 on 2017/12/7.
 */
$(function(){
    // 文章导航切换
    $('.abs-pt-nav li').click(function () {
        $(".abs-pt-textInfo .abs-text-info").removeClass("abs-show").addClass("abs-hidden");
        $('.abs-pt-nav li').find("a").removeClass("active li-active-style");
        $(this).find("a").addClass("active li-active-style");
        var _index = $(this).index();
        $(".abs-pt-textInfo .abs-text-info").eq(_index).addClass("abs-show").removeClass("abs-hidden");
    });
    // 当滚动屏幕超过垂直导航时将侧面导航位置固定在顶部
    $(window).scroll(function () {
        var width = document.body.scrollWidth;
        var scrollHight = $(this).scrollTop();
        var height1 = $(".top-nav").height();
        var height2 = $(".x_search_wrap").height();
        var height3 = $(".navbox").height();
        var total_height = height1+height2+height3+20;
        if (width > 70) {
            if (scrollHight > total_height) {
                $(".abs-pt-nav").css("position", "fixed");
            } else {
                $(".abs-pt-nav").css("position", "relative");
            }
        } else {
            if (scrollHight > total_height) {
                $(".abs-pt-nav").css("position", "relative");
            } else {
                $(".abs-pt-nav").css("position", "relative");
            }
        }
    });
})
